<template>
  <div id="detailes_table">
    <el-table
      :data="tableData"
      stripe
      style="width: 100%"
    >
      <el-table-column
        prop="date"
        label="订单编号"
        width="180"
      />
      <el-table-column
        prop="name"
        label="下单时间"
        width="180"
      />
      <el-table-column
        prop="name"
        label="总价"
        width="180"
      />
      <el-table-column
        prop="name"
        label="状态"
        width="180"
      />
      <el-table-column
        prop="name"
        label="顾客id"
        width="180"
      />
      <el-table-column
        label="操作"
      >
        <template slot-scope="scope">
          <el-button type="text" @click="orderdetails(scope.row.id)">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import qs from 'querystring'
export default {
  data() {
    return {
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1517 弄'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }]
    }
  },
  created() {
    // this.findcustomerId();
  },
  methods: {
    // 给详情按钮绑定事件
    orderdetails(row) {
      this.$router.push({ path: '/orderdetails/index', params: { id: id }})
    },

    // 封装获取到某个顾客的所有订单信息
    findcustomerId(id) {
      var id = id
      console.log(id, '-----')
      var data = {
        page: 1,
        pageSize: 10,
        customerId: 28
      }
      this.$axios.post('/order/queryPage', qs.stringify(data)).then(response => {
        console.log(response.data.data.list)
      })
    }
    //    sendItem(){
    //     alert('123');
    // }
  }
}
</script>
<style lang="scss" scoped>

</style>
